package com.woniuxy.hrp.mapper;

import com.woniuxy.hrp.entity.DoctorAndPatientAndItem;
import com.woniuxy.hrp.entity.DoctorPatientMedicine;
import org.apache.ibatis.annotations.One;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @program: hrph
 * @InterfaceName DoctorPatientMedicineMapper
 * @description:医生患者用药记录
 * @author: LRW
 * @create: 2022-09-08 14:35
 * @Version 1.0
 **/
public interface DoctorPatientMedicineMapper {

    /***
     * @description: 根据就诊记录id查改医生患者用药记录
     * @param: MrecordId
     * @return: java.util.List<com.woniuxy.hrp.entity.DoctorAndPatientAndItem>
     * @author Lrw
     * @date: 2022/9/8 14:43
     */
    @Select("select * from hrp_doctor_patient_medicine where mrecord_id=#{MrecordId}")
    @Results({
            @Result(column = "medicine_id",property = "medicine",one= @One(select = "com.woniuxy.hrp.mapper.MedicineMapper.getById")),
            @Result(column = "doctor_id",property = "doctor",one = @One(select = "com.woniuxy.hrp.mapper.DoctorMapper.selectByDoctorId"))
    })
    public List<DoctorPatientMedicine> selectByMrecordId(int MrecordId);
}
